from datetime import datetime, timedelta

def get_date(date_str, n):
    input_date = datetime.strptime(date_str, '%Y%m%d')
    days_before = input_date - timedelta(days=n)
    return days_before.strftime('%Y-%m-%d')